package com.clkj.sunhelp.mvp.personlcenter;

import android.os.Bundle;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.clkj.sunhelp.R;
import com.clkj.sunhelp.common.SharePreKey;
import com.clkj.sunhelp.mvp.base.BaseActivity;
import com.clkj.sunhelp.util.CommonUtil;
import com.clkj.sunhelp.util.SPUtils;
import com.jakewharton.rxbinding.view.RxView;

import rx.functions.Action1;

/**个人中心
 * Created by Administrator on 2017/3/29.
 */

public class ActivityPersonlCenter extends BaseActivity{

    private TextView tvRealName;
    private TextView tvContactTel;
    private TextView tvExit;
    private RelativeLayout layoutCheckVersionUpdate;





    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_personal_center);
        initTitleWithRightTvOrIv(null,null,"个人中心",true,null,null);
        initData();
        assignView();
        initView();
    }

    @Override
    public void initData() {

    }

    @Override
    public void assignView() {
        tvRealName = (TextView) findViewById(R.id.tv_real_name);
        tvContactTel = (TextView) findViewById(R.id.tv_contact_tel);
        tvExit = (TextView) findViewById(R.id.tv_exit);
        layoutCheckVersionUpdate = (RelativeLayout) findViewById(R.id.layout_check_version_update);
    }

    @Override
    public void initView() {
        tvRealName.setText((CharSequence) CommonUtil.getShareValue(SharePreKey.SP_KEY_REALNAME,""));
        tvContactTel.setText((CharSequence) CommonUtil.getShareValue(SharePreKey.SP_KEY_CONTACT_TEL,""));


        RxView.clicks(tvExit)
                .subscribe(new Action1<Void>() {
                    @Override
                    public void call(Void aVoid) {
                        SPUtils.clear(ActivityPersonlCenter.this);
                        CommonUtil.putShareValue(SharePreKey.SP_KEY_LOGIN_TAG, new Boolean(false));
                        finish();
                    }
                });
    }


}
